class CreateAmounts < ActiveRecord::Migration
  def self.up
    create_table :amounts do |t|
      t.references :wallet, :null => false
      t.string :currency_code, :limit => 3, :null => false

      t.decimal :value, :default => 0
    end

    add_index :amounts, [:wallet_id, :currency_code], :unique => true
  end

  def self.down
    drop_table :amounts
  end
end
